package org.study.mybatisplus.dynamic.boot.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.study.mybatisplus.dynamic.boot.model.IotDevice;
import org.study.mybatisplus.dynamic.boot.vo.DeviceVO;

import java.util.List;
import java.util.Map;

/**
 * @author doveylovey
 * @version v1.0.0
 * @email 1135782208@qq.com
 * @date 2024年10月08日
 */
@Mapper
public interface IotDeviceMapper extends BaseMapper<IotDevice> {
    IPage<DeviceVO> selectDeviceList(Page<DeviceVO> page,
                                     @Param("projectId") Long projectId,
                                     @Param("deviceName") String deviceName);

    DeviceVO selectDeviceDetail(@Param("deviceId") Long deviceId);

    Map<String, String> selectDeviceStatus(@Param("projectId") Long projectId);

    Map<String, String> selectMsg(@Param("tableName") String tableName,
                                  @Param("startDate") String startDate,
                                  @Param("endDate") String endDate,
                                  @Param("startWithDate") String startWithDate,
                                  @Param("startWithDayOfMonth") String startWithDayOfMonth);

    List<Map<String, String>> selectMsgForCharts(@Param("tableName") String tableName,
                                                 @Param("interval") String interval,
                                                 @Param("startTime") String startTime,
                                                 @Param("endTime") String endTime);
}
